package com.devilvan.betrice.sensitive.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.devilvan.betrice.sensitive.dto.SysSensitiveLogDto;
import com.devilvan.betrice.sensitive.mapper.SysSensitiveLogMapper;
import com.devilvan.betrice.sensitive.po.SysSensitiveLogPo;
import com.devilvan.betrice.sensitive.repository.SysSensitiveLogRepository;
import com.devilvan.betrice.sensitive.service.SysSensitiveLogService;
import com.devilvan.betrice.util.UCopy;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
* @author Evad.Wu
* @Description 敏感操作信息表 业务逻辑类
* @date 2023-08-13
*/
@Service
public class SysSensitiveLogServiceImpl extends ServiceImpl<SysSensitiveLogMapper, SysSensitiveLogPo> implements SysSensitiveLogService {
    @Resource(name = "sysSensitiveLogRepository")
    private SysSensitiveLogRepository sysSensitiveLogRepository;

    @Override
    public SysSensitiveLogPo saveUpdate(SysSensitiveLogDto sysSensitiveLogDto) {
        SysSensitiveLogPo sysSensitiveLogPo = new SysSensitiveLogPo();
        UCopy.fullCopy(sysSensitiveLogDto, sysSensitiveLogPo);
        return sysSensitiveLogRepository.saveAndFlush(sysSensitiveLogPo);
    }

    @Override
    public List<SysSensitiveLogPo> saveUpdateBatch(List<SysSensitiveLogDto> list) {
        List<SysSensitiveLogPo> sysSensitiveLogPoList = UCopy.fullCopyCollections(list, SysSensitiveLogPo.class);
        return sysSensitiveLogRepository.saveAllAndFlush(sysSensitiveLogPoList);
    }


}
